<!doctype html>
<html>
<title>Welcome</title>
<head>
	<center><h2>Please enter your details</h2></center>	
</head>
	<body>
		<script>
function validateForm(inputtxt, minlength, maxlength) {
	var a = document.forms["form1"]["Username"].value;
	var specialchar = "!@#$%^&*()+=[]\';,./{}|:<>?~";
		if (a == null || a == "") 
				{	alert("You must enter Username");	return false;	}
		if (a.length < 3 || a.length > 10)
				{ alert("Enter username between 3 and 10 characters.");	return false;	}
		if (/^[a-zA-Z0-9-_]*$/.test(a) == false)
				{	alert('Username Contains special Characters!');		}
	var b = document.forms["form1"]["Password"].value;
		if (b== null || b== "") 
				{	alert("You must enter Password");	return false;	}
		if (/^(?=.*\d)(?=.*[a-zA-Z])(?!.*[\W_\x7B-\xFF]).{2,}$/.test(b) == false )
				{	alert("Password must contain at least one letter and one number!");		return false;	} 
	var c = document.forms["form1"]["Password1"].value;
		if (c != b)
				{	alert("Passwords do not match"); return false;	}
	var d = document.forms["form1"]["email"].value;
	var atpos = d.indexOf("@");
	var lastatpos = d.lastIndexOf("@");
	var dotpos = d.lastIndexOf(".");
	var dotpos1 = d.indexOf(".");
	var dashpos = d.indexOf("-");
		if (atpos< 1 || dotpos<atpos+2 || dotpos+2>=d.length || dotpos1<2 || dashpos==atpos+1 || lastatpos > dotpos || lastatpos != atpos || /^[a-zA-Z0-9-_@.]*$/.test(d) == false) 
				{	alert("Please enter a valid E-mail address");	return false;	}
	var e = document.forms["form1"]["FirstName"].value;
		if (e== null || e== "") 
				{	alert("You must enter Your name");	return false;	}
		if (/^[a-zA-Z]*$/.test(e) == false)
				{	alert('FirstName Contains special Characters!');	return false;	}
	var f = document.forms["form1"]["LastName"].value;
		if (f== null || f== "") 
				{	alert("You must enter Your name");	return false;	}
		if (/^[a-zA-Z]*$/.test(f) == false)
				{	alert('Last Name Contains special Characters!');	return false;	}	return true;	}
	</script>
<fieldset>
	<form name="form1" onsubmit="return validateForm()"  method="get" action="congrat.html">
	
			<label>Username: </label>
			<center>
				<input type="text" id=Username name=Username maxlength="10" placeholder="Input Username">
			</center>
			
			<label>Password: </label>
			<center>
				<input type="password" name=Password placeholder="Input Password">
			</center>
			
			<label>Re-type Password: </label>
			<center>
				<input type="password" name=Password1 placeholder="Confirm Password">
			</center>
			
			<label>Email address: </label>
			<center>
				<input type="email" name=email  placeholder="Input your e-mail">
			</center>
			
			<label>First Name: </label>
			<center>
				<input type="text" name=FirstName placeholder="Input your name">
			</center>
			
			<label>Last Name: </label>
			<center>
				<input type="text" name=LastName placeholder="Input your last name">
			</center>
			
			<input type="submit" value="Register">
</fieldset>
</form>
</body>
</html>